clear all;

load smthResults.mat

% wholemat = [k,c,inv,lambda,PR Penergy]
%             1 2 3      4    5    6
% renewmat = [kr cr ir lambdar PRr P_Er Hr jr]
%              1  2  3  4       5    6  7  8
% fossilmat = [kf cf invf lambdaf PRf P_Ef Sf Nf nf gf sigmaf];
%              1   2   3     4     5   6    7  8  9 10   11

figure(1)
subplot(2,2,1)
plot (1:Tmat0(1)+1,wholemat0(:,1),'b');
xlabel('year t')
ylabel('capital k')
title('(a)')
% xlim([80, 120])


subplot(2,2,2)
plot (1:Tmat0(1)+1,wholemat0(:,2),'b');
title('(b)')
xlabel('year t')
ylabel('consumption c')
% xlim([80, 120]);

subplot(2,2,3) 
plot (1:Tmat0(1)+1,wholemat0(:,3),'b');
% xlim([80, 120])
title('(c)')
xlabel('year t')
ylabel('investment i')

subplot(2,2,4)
plot (1:Tmat0(1)+1,wholemat0(:,4)/wholemat0(1,4),'b');
title('(d)')
% xlim([80, 120])
xlabel('year t')
ylabel('good price p')
print -r600 -depsc ./ch2/full_PO

%% 
figure(2)
% subplot(2,2,1) 
% plot (1:Tmat0(1)+1,wholemat0(:,5),'b');
% % xlim([80, 120])
% title('(a)')
% xlabel('year t')
% ylabel('price ratio')

subplot(2,2,1) 
plot (1:Tmat0(1)+1,wholemat0(:,6),'b')
title('a')
% xlim([80, 120])
xlabel('year t')
ylabel('energy price')

subplot(2,2,2) 
plot (1:Tmat0(1)+1,wholemat0(:,2)./(0.2772*wholemat0(:,1)),'b');
title('b')
xlabel('year t')
ylabel('consumption c/output Ak')

subplot(2,2,3) 
plot (1:Tmat0(1)+1,wholemat0(:,3)./(0.2772*wholemat0(:,1)),'b');
title('(c)')
xlabel('year t')
ylabel('investment i/output Ak')

techinv0 = [fossilmat0(:,9);renewmat0(:,8)];
subplot(2,2,4) 
plot (1:Tmat0(1)+1,(wholemat0(:,3)+techinv0)./(0.2772*wholemat0(:,1)),'b');
title('(d)')
xlabel('year t')
ylabel('investment (i+n+j)/output Ak')

print -r600 -depsc ./ch2/full_pricePO

%%
figure(3)
subplot(2,2,1)
semilogy (1:Tmat0(1)+1,wholemat0(:,1),'b');
title('(a)')
xlabel('year t')
ylabel('capital k')
hold off

subplot(2,2,2)
semilogy (1:Tmat0(1)+1,wholemat0(:,2),'b')
title('(b)')
xlabel('year t')
ylabel('consumption c')
hold off

subplot(2,2,3) 
semilogy (1:Tmat0(1)+1,wholemat0(:,3),'b')
title('(c)')
xlabel('year t')
ylabel('investment i')
hold off

subplot(2,2,4)
semilogy (1:Tmat0(1)+1,wholemat0(:,4)/wholemat0(1,4),'b')
title('(d)')
xlabel('year t')
ylabel('good price p')
hold off
print -r600 -depsc ./ch2/full_logPO

%%
figure(4)
subplot(2,2,1)
plot (1:Tmat0(2)+1,fossilmat0(:,1),'b')
title('(a)')
xlabel('year')
ylabel('capital stock k')
hold off

subplot(2,2,2)
plot (1:Tmat0(2)+1,fossilmat0(:,2),'b')
title('(b)')
xlabel('year')
ylabel('consumption c')
hold off

subplot(2,2,3) 
plot (1:Tmat0(2)+1,fossilmat0(:,3),'b')
title('(c)')
xlabel('year')
ylabel('investment i')
hold off

subplot(2,2,4) 
plot (1:Tmat0(2)+1,fossilmat0(:,6),'b')
title('(d)')
xlabel('year')
ylabel('energy price')
hold off
print -r600 -depsc ./ch2/fossil1PO

%%
figure(5)
subplot(2,2,1)
plot (1:Tmat0(2)+1,fossilmat0(:,7),'b')
title('(a)')
xlabel('year')
ylabel('cumulative production S')
hold off

subplot(2,2,2)
plot (1:Tmat0(2)+1,fossilmat0(:,8),'b')
title('(b)')
xlabel('year')
ylabel('technological progress N')
hold off

subplot(2,2,3) 
plot (1:Tmat0(2)+1,fossilmat0(:,10),'b')
title('(c)')
xlabel('year')
ylabel('marginal extraction cost g')
hold off

subplot(2,2,4) 
plot (1:Tmat0(2)+1,fossilmat0(:,9),'b')
title('(d)')
xlabel('year')
ylabel('R&D investment n')
hold off
print -r600 -depsc ./ch2/fossil2PO

%%
figure(6)
subplot(2,2,1)
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,1),'b')
title('(a)')
xlabel('year')
ylabel('capital k')
hold off

subplot(2,2,2)
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,2),'b')
title('(b)')
xlabel('year')
ylabel('consumption c')
hold off

subplot(2,2,3) 
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,3),'b')
title('(c)')
xlabel('year')
ylabel('investment i')
hold off

subplot(2,2,4) 
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,4),'b')
title('(d)')
xlabel('year')
ylabel('good price p')
hold off
print -r600 -depsc ./ch2/renew1PO

%%
figure(7)
% subplot(2,2,1)
% plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,5),'b')
% % xlim([0,3])
% title('(a)')
% xlabel('year')
% ylabel('good price ratio ')
% hold off
% 
% subplot(2,2,2)
% plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,6),'b')
% % xlim([0,3])
% title('(b)')
% xlabel('year')
% ylabel('energy price ')
% hold off

subplot(2,2,1) 
plot (1:Tmat0(1)-Tmat0(2),(26.0238+renewmat0(:,7)).^(-0.25),'b')
title('(a)')
xlabel('year')
ylabel('marginal cost of production m')

% subplot(2,2,1) 
% plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,7),'b')
% title('(a)')
% xlabel('year')
% ylabel('cumulative knowledge H')
% hold off

subplot(2,2,2) 
plot (1:Tmat0(1)-Tmat0(2),renewmat0(:,8),'b')
title('(b)')
xlabel('year')
ylabel('R&D investment j')
hold off
print -r600 -depsc ./ch2/renew2PO


